From: Siebrand Mazeland Date: Mon, 8 Jun 2009 10:07:33 +0000 (+0000) Subject: Replace a few remaining uses of deprecated makeKnownLinkObj() by link[Known]() in... X-Git-Tag: 1.31.0-rc.0~41449 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=7661bbeba58f4c69cd137ac4ad2a0f8d4a62faee;p=lhc%2Fweb%2Fwiklou.git Replace a few remaining uses of deprecated makeKnownLinkObj() by link[Known]() in core. Only uses in core remaining are in includes/Linker.php (all related to deprecated methods) and includes/parser/Parser.php. Linking this to r51559 for CodeReview as there is some discussion there, and these changes are very similar. --- diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 3739304d11..922d524214 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -108,11 +108,22 @@ class LogEventsList { $links = array(); $hiddens = ''; // keep track for "go" button foreach( $filter as $type => $val ) { + // Should the below assignment be outside the foreach? + // Then it would have to be copied. Not certain what is more expensive. + $query = $this->getDefaultQuery(); + $queryKey = "hide_{$type}_log"; + $query[$queryKey] = $hideVal; + $hideVal = 1 - intval($val); - // FIXME: use link() here. Needs changes in getDefaultQuery() - $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal], - wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() ) + + $link = $this->skin->link( + $wgTitle, + $messages[$hideVal], + array(), + $query, + array( 'known', 'noclasses' ) ); + $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link ); $hiddens .= Xml::hidden( "hide_{$type}_log", $val ) . "\n"; } diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 511cc3a71a..a874773a52 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -65,13 +65,13 @@ function wfSpecialNewimages( $par, $specialPage ) { } $where = array(); - $searchpar = ''; + $searchpar = array(); if ( $wpIlMatch != '' && !$wgMiserMode) { $nt = Title::newFromUrl( $wpIlMatch ); if( $nt ) { $m = $dbr->escapeLike( strtolower( $nt->getDBkey() ) ); $where[] = "LOWER(img_name) LIKE '%{$m}%'"; - $searchpar = '&wpIlMatch=' . urlencode( $wpIlMatch ); + $searchpar['wpIlMatch'] = $wpIlMatch; } } @@ -163,29 +163,75 @@ function wfSpecialNewimages( $par, $specialPage ) { # If we change bot visibility, this needs to be carried along. if( !$hidebots ) { - $botpar = '&hidebots=0'; + $botpar = array( 'hidebots' => 0 ); } else { - $botpar = ''; + $botpar = array(); } $now = wfTimestampNow(); $d = $wgLang->date( $now, true ); $t = $wgLang->time( $now, true ); - $dateLink = $sk->makeKnownLinkObj( $titleObj, htmlspecialchars( wfMsg( 'sp-newimages-showfrom', $d, $t ) ), - 'from='.$now.$botpar.$searchpar ); - - $botLink = $sk->makeKnownLinkObj($titleObj, wfMsgHtml( 'showhidebots', - ($hidebots ? wfMsgHtml('show') : wfMsgHtml('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar); - + $query = array_merge( + array( 'from' => $now ), + $botpar, + $searchpar + ); + + $dateLink = $sk->linkKnown( + $titleObj, + htmlspecialchars( wfMsg( 'sp-newimages-showfrom', $d, $t ) ), + array(), + $query + ); + + $query = array_merge( + array( 'hidebots' => ( $hidebots ? 0 : 1 ) ), + $searchpar + ); + + $message = wfMsgHtml( + 'showhidebots', + ( $hidebots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' ) ) + ); + + $botLink = $sk->linkKnown( + $titleObj, + $message, + array(), + $query + ); $opts = array( 'parsemag', 'escapenoentities' ); $prevLink = wfMsgExt( 'pager-newer-n', $opts, $wgLang->formatNum( $limit ) ); if( $firstTimestamp && $firstTimestamp != $latestTimestamp ) { - $prevLink = $sk->makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar ); + $query = array_merge( + array( 'from' => $firstTimestamp ), + $botpar, + $searchpar + ); + + $prevLink = $sk->linkKnown( + $titleObj, + $prevLink, + array(), + $query + ); } $nextLink = wfMsgExt( 'pager-older-n', $opts, $wgLang->formatNum( $limit ) ); if( $shownImages > $limit && $lastTimestamp ) { - $nextLink = $sk->makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar ); + $query = array_merge( + array( 'until' => $lastTimestamp ), + $botpar, + $searchpar + ); + + $nextLink = $sk->linkKnown( + $titleObj, + $nextLink, + array(), + $query + ); + } $prevnext = '

' . $botLink . ' '. wfMsgHtml( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'

';